package com.gaohe.official.controller;

import java.util.List;
import java.io.IOException;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gaohe.common.log.annotation.Log;
import com.gaohe.common.log.enums.BusinessType;
import com.gaohe.common.security.annotation.RequiresPermissions;
import com.gaohe.official.domain.FmExamine;
import com.gaohe.official.service.IFmExamineService;
import com.gaohe.common.core.web.controller.BaseController;
import com.gaohe.common.core.web.domain.AjaxResult;
import com.gaohe.common.core.utils.poi.ExcelUtil;
import com.gaohe.common.core.web.page.TableDataInfo;

/**
 * 认证审核Controller
 * 
 * @author ruoyi
 * @date 2025-06-03
 */
@RestController
@RequestMapping("/examine")
public class FmExamineController extends BaseController
{
    @Autowired
    private IFmExamineService fmExamineService;

    /**
     * 查询认证审核列表
     */
    @RequiresPermissions("official:examine:list")
    @GetMapping("/list")
    public TableDataInfo list(FmExamine fmExamine)
    {
        startPage();
        List<FmExamine> list = fmExamineService.selectFmExamineList(fmExamine);
        return getDataTable(list);
    }

    /**
     * 导出认证审核列表
     */
    @RequiresPermissions("official:examine:export")
    @Log(title = "认证审核", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FmExamine fmExamine)
    {
        List<FmExamine> list = fmExamineService.selectFmExamineList(fmExamine);
        ExcelUtil<FmExamine> util = new ExcelUtil<FmExamine>(FmExamine.class);
        util.exportExcel(response, list, "认证审核数据");
    }

    /**
     * 获取认证审核详细信息
     */
    @RequiresPermissions("official:examine:query")
    @GetMapping(value = "/{examineId}")
    public AjaxResult getInfo(@PathVariable("examineId") Long examineId)
    {
        return success(fmExamineService.selectFmExamineByExamineId(examineId));
    }

    /**
     * 新增认证审核
     */
    @RequiresPermissions("official:examine:add")
    @Log(title = "认证审核", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FmExamine fmExamine)
    {
        return toAjax(fmExamineService.insertFmExamine(fmExamine));
    }

    /**
     * 修改认证审核
     */
    @RequiresPermissions("official:examine:edit")
    @Log(title = "认证审核", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FmExamine fmExamine)
    {
        return toAjax(fmExamineService.updateFmExamine(fmExamine));
    }

    /**
     * 删除认证审核
     */
    @RequiresPermissions("official:examine:remove")
    @Log(title = "认证审核", businessType = BusinessType.DELETE)
	@DeleteMapping("/{examineIds}")
    public AjaxResult remove(@PathVariable Long[] examineIds)
    {
        return toAjax(fmExamineService.deleteFmExamineByExamineIds(examineIds));
    }
}
